const { defineConfig } = require('@vue/cli-service')

const path = require('path')

const packageName = 'vue2Demo'

function resolve(dir) {
  return path.join(__dirname, dir)
}
const port = 9004
module.exports = defineConfig({
  transpileDependencies: true,
  // 自定义webpack配置
  configureWebpack: {
    resolve: {
      alias: {
        '@': resolve('src')
      }
    },
    output: {
      // 把子应用打包成 umd 库格式 commonjs 浏览器，node环境
      library: `${packageName}`,
      libraryTarget: 'umd'
    }
  },
  devServer: {
    port,
    headers: {
      'Access-Control-Allow-Origin': '*'// 本地服务的跨域内容
    }
  }
})
